var app = getApp()
var util = require("../../utils/util.js")
var orderModel = require("../../model/orderModel.js")
var host = app.data.host
Page({

  /**
   * 页面的初始数据
   */
  data: {
    evas: ["非常差", "差", "一般", "好", "非常好"],
    tags: [null, null, null, ["整洁"],
      ["干净", "大气", "专业"]
    ],
    arr: [1, 2, 3, 4, 5],
    arrIndex: 4,
    order: null,
    goodsList: null,
    anonymity: 1,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    this.init()
  },


  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },
  init() {
    var order = app.data.tempOrder
    var that = this
    util.showLoading("加载中")
    orderModel.getOrderEvaluates(order.id, res => {
      wx.hideLoading()
      that.setData({
        order: order,
        list: res.data,
        anonymity: res.data[0].anonymity
      })
    })
  },
  //门店评分
  bindScore(e) {
    var index = e.currentTarget.id
    this.setData({
      arrIndex: index
    })
  },

  bindAnonymity(e) {
    this.setData({
      anonymity: e.detail.value.length == 0 ? 0 : 1
    })
  }
})
